package bfgca;
import java.util.*;

public class Map {

   private ArrayList<StarSystem> systems;
   
   public Map(ArrayList<StarSystem> s){
     this.systems = s;
   }
   
   public Map(){
       this.systems = new ArrayList<StarSystem>();
   }
   public ArrayList<StarSystem> getSystems(){ return this.systems;}
   
   public void addSystem(StarSystem sys){
     this.systems.add(sys);
   }
   
   //attempts to remove object which matches sys by a .equals() comparison
   //from Map's current list of systems.  Returns true if successful. 
   //If successful, only the first instance encountered when traversing the 
   //list from 0 to size is removed. Returns false if the system could not be 
   //found in Map's array list.
   public boolean removeSystem(StarSystem sys){
     for(int i = 0; i < this.systems.size(); i++){
       if(this.systems.get(i).equals(sys) ){
         this.systems.remove(i);
         return true;
       }
     }
     return false;
   }
}
